package com.czl.base.data.api

import com.czl.base.base.BaseBean
import com.czl.base.data.bean.*
import io.reactivex.Observable
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * @author Alwyn
 * @Date 2020/7/22
 * @Description
 */
interface ApiService {

    /**
     * 登录
     */
//    @Headers("Domain-Name: douban") // Add the Domain-Name header
    @POST("system/app/user/login/pwd")
    fun loginByPwd(
        @Body info: RequestBody
    ): Observable<BaseBean<UserBean>>

    /**
     * 验证码登录
     */
    @POST("system/app/user/login/vc")
    fun loginByPhoneCode(
        @Body info: RequestBody
    ): Observable<BaseBean<UserBean>>

    /**
     * 删除个人车辆
     */
    @POST("parking/app/parking/vehicle/delete")
    fun deleteCarList(
        @Body info: RequestBody
    ): Observable<BaseBean<Any?>>

    /**
     * 我的查询历史车辆列表
     */
    @POST("parking/app/parking/vehicle/myQueryHistory")
    fun getMyQueryHistory(): Observable<BaseBean<List<CarItem>>>

    /**
     * 获取用户详细信息
     */
    @GET("system/app/user/getUserInfo")
    fun getUserInfoNet(): Observable<BaseBean<UserInfo>>

    /**
     * 获取热线
     */
    @GET("system/app/user/hotLine")
    fun getHotLine(@Query("areaId") areaId: String): Observable<BaseBean<String>>

    /**
     * 获取注销须知
     */
    @GET("system/app/user/logout/notice")
    fun getDeleteNotice(): Observable<BaseBean<String>>

    /**
     * 退出登录
     */
    @DELETE("system/app/user/logout")
    fun logout(): Observable<BaseBean<Any?>>

    /**
     * 业主撤销工单
     */
    @DELETE("property/workOrder/repair/cancel/{no}")
    fun cancelWorkOrder(@Path("no") no: String): Observable<BaseBean<Any?>>

    /**
     * 阅读指定消息
     */
    @GET("property/message/read")
    fun readNotice(@Query("msgId") msgId: String): Observable<BaseBean<Any?>>

    /**
     * 业主撤销投诉
     */
    @DELETE("property/workOrder/complain/cancel/{no}")
    fun cancelComplaint(@Path("no")no:String):Observable<BaseBean<Any?>>
    /**
     * 业主撤销工单
     */
    @DELETE("property/workOrder/repair/delete/{no}")
    fun deleteWorkOrder(@Path("no") no: String): Observable<BaseBean<Any?>>
    /**
     * 业主删除投诉
     */
    @DELETE("property/workOrder/complain/delete/{no}")
    fun deleteComplaint(@Path("no") no:String):Observable<BaseBean<Any?>>

    /**
     * 获取手机验证码
     */
    @POST("system/app/user/verifyCode")
    fun getPhoneCode(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 业主评价工单
     */
    @POST("property/workOrder/repair/evaluate")
    fun evaluateOrder(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 业主评价投诉
     */
    @POST("property/workOrder/complain/evaluate")
    fun evaluateComplaint(@Body info: RequestBody):Observable<BaseBean<Any?>>
    /**
     * APP对管家评论
     */
    @POST("system/houseKeeper/evaluate/create")
    fun evaluateHouseKeeper(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 修改用户信息
     */
    @POST("system/app/user/changeUserInfo")
    fun changeUserInfo(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 户主为指定成员下发人脸信息
     */
    @POST("system/ownerApply/uploadFace")
    fun uploadApplyFace(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * APP首页查询管家
     */
    @POST("system/houseKeeper/app/index/list")
    fun queryHouseKeeperList(@Body info: RequestBody): Observable<BaseBean<HouseKeeperBean>>

    /**
     * app分页查询管家列表
     */
    @POST("system/houseKeeper/app/list")
    fun getHouseKeepers(@Body info:RequestBody):Observable<BaseBean<HouseKeeperListBean>>
    /**
     * 后台查询管家列表
     */
    @POST("system/houseKeeper/list")
    fun webGetHouseKeepers(@Body info: RequestBody):Observable<BaseBean<HouseKeeperListBean>>
    /**
     * 找回密码
     */
    @POST("system/app/user/retrievePassword")
    fun retrievePassword(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 修改密码
     */
    @POST("system/app/user/changePassword")
    fun verifyPwdNet(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 初始化密码
     */
    @POST("system/app/user/initPassword")
    fun initPassword(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 添加个人车辆
     */
    @POST("parking/app/parking/vehicle/add")
    fun addPersonCar(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 获取月卡列表
     */
    @POST("parking/app/parking/parkingCard/myCardList")
    fun getMonthCardList(@Body info: RequestBody): Observable<BaseBean<MonthCardListBean>>

    /**
     * 缴费记录
     */
    @POST("payment/orders/parking/list")
    fun getPayRecordList(@Body info: RequestBody): Observable<BaseBean<PayRecordListBean>>

    /**
     * 月卡停车下订单
     */
    @POST("parking/parking/pay/placeAnOrder")
    fun placeAnOrder(@Body info: RequestBody): Observable<BaseBean<PayInfoBean>>

    /**
     * 工单下订单
     */
    @POST("property/workOrder/repair/toPay")
    fun payWorkOrder(@Body info: RequestBody): Observable<BaseBean<WorkOrderPayBean>>

    /**
     * 反向寻车
     */
    @POST("parking/app/parking/trackVehicle")
    fun reverseSearchCar(@Body info: RequestBody): Observable<BaseBean<ReverseSearchBean>>

    /**
     * 注销用户账户
     */
    @DELETE("system/app/user/deleteUserAccount")
    fun deleteUserAccount(): Observable<BaseBean<Any?>>

    @Multipart
    @POST("file/upload")
    fun uploadHeadImg(@Part file: MultipartBody.Part): Observable<BaseBean<ImgRspBean>>
    @Multipart
    @POST("file/upload")
    fun uploadHeadImg(@Query("bucketName") bucketName:String,
                      @Part file: MultipartBody.Part,
                      @Query("folderName") folderName:String): Observable<BaseBean<ImgRspBean>>

    /**
     * 注册
     */
    @POST("user/register")
    @FormUrlEncoded
    fun register(
        @Field("username") username: String,
        @Field("password") password: String,
        @Field("repassword") repassword: String
    ): Observable<BaseBean<Any?>>

    /**
     * 查询个人车辆
     */
    @POST("parking/app/parking/vehicle/myList")
    @FormUrlEncoded
    fun getMyCarList(
        @Field("vehiclesWithNoPlan") vehiclesWithNoPlan: Boolean,
        @Field("areaId") areaId: String
    ): Observable<BaseBean<List<CarItem>>>

    /**
     * 获取版本号
     */
    @GET("system/app/user/version")
    fun getVersionName(@Query("type") type: String): Observable<BaseBean<Any?>>

    /**
     * 添加成员申请
     */
    @POST("system/ownerApply/add")
    fun addPeople(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * APP重新添加成员
     */
    @PUT("system/ownerApply/addAgain")
    fun updatePeople(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * APP查询报修记录
     */
    @POST("property/workOrder/repair/reportList")
    fun getRepairList(@Body info: RequestBody): Observable<BaseBean<ReportListBean>>

    /**
     * 分页查询个人消息列表
     */
    @POST("property/message/profileList")
    fun getNoticeMsgList(@Body info: RequestBody): Observable<BaseBean<NoticeListBean>>

    /**
     * app查询投诉记录
     */
    @POST("property/workOrder/complain/list")
    fun getComplainList(@Body info:RequestBody):Observable<BaseBean<ReportListBean>>

    /**
     * APP对管家评论
     */
    @POST("system/houseKeeper/evaluate/search/owner")
    fun getScoreList(@Body info: RequestBody): Observable<BaseBean<ScoreListBean>>

    /**
     * APP查询个人申请记录列表
     */
    @GET("system/ownerApply/list/apply")
    fun getApplyRecords(@Query("areaId") areaId: String): Observable<BaseBean<List<AddRecordBean>>>

    /**
     * APP删除申请记录
     */
    @DELETE("system/ownerApply/delete/apply")
    fun deleteApply(@Query("id") id: String): Observable<BaseBean<Any?>>

    /**
     * APP删除人员管理业主
     */
    @DELETE("system/ownerApply/delete/owner")
    fun deleteHouseUser(@Query("id") id: String): Observable<BaseBean<Any?>>

    /**
     * APP查询个人人员管理列表
     */
    @GET("system/ownerApply/list/owner")
    fun getOwnerRecords(@Query("areaId") areaId: String, @Query("houseId") houseId: String): Observable<BaseBean<List<PeopleManagerBean>>>

    /**
     * 业主积分明细查询
     */
    @POST("property/points/detail/list")
    fun getIntegralList(@Body info: RequestBody): Observable<BaseBean<IntegralBean>>

    /**
     * APP累积积分
     */
    @GET("property/points/detail/total/{areaNo}")
    fun getPointDetail(@Path("areaNo") areaNo: String): Observable<BaseBean<String>>

    /**
     * 删除停车查询记录
     */
    @GET("parking/parking/pay/deleteQueryRecord")
    fun deleteQueryCar(
        @Query("vehicleNo") vehicleNo: String,
        @Query("areaId") areaId: String
    ): Observable<BaseBean<Any?>>

    /**
     * 获取缴费详情
     */
    @GET("payment/orders/parking/detail/{orderNo}")
    fun getRecordDetail(@Path("orderNo") orderNo: String): Observable<BaseBean<RecordDetailBean>>

    /**
     * 查询订单支付结果
     */
    @POST("payment/allinpay/query")
    @FormUrlEncoded
    fun queryPayResult(
        @Field("orderNo") orderNo: String,
        @Field("areaId") areaId: String
    ): Observable<BaseBean<PayResultBean>>

    /**
     * 添加月卡时，计算月卡价格
     */
    @GET("parking/app/parking/parkingCard/feePerMonth")
    fun getMonthPrice(
        @Query("vehicleNo") vehicleNo: String,
        @Query("areaId") areaId: String
    ): Observable<BaseBean<Float>>

    /**
     * 请求计费
     */
    @GET("parking/parking/pay/parkCharging")
    fun parkCharging(
        @Query("vehicleNo") vehicleNo: String
    ): Observable<BaseBean<PayDetail>>

    /**
     * 根据业主ID查询业主关联房屋信息
     */
    @GET("system/owner/list/byOwnerPhone")
    fun getUserRooms(
        @Query("phone") phone: String,
        @Query("areaId") areaId: String,
    ): Observable<BaseBean<List<RoomBean>>>

    /**
     * APP查询-根据申请ID查询申请记录详情
     */
    @GET("system/ownerApply/get/apply")
    fun getApplyDetail(
        @Query("id") id: String
    ): Observable<BaseBean<UserDetailBean>>

    /**
     * APP查询-根据ID查询业主个人信息
     */
    @GET("system/ownerApply/get/owner")
    fun getOwnerDetail(
        @Query("id") id: String
    ): Observable<BaseBean<UserDetailBean>>

    /**
     * 查询报修类型
     * @param pType 1.告警工单，2.报事报修，3.投诉建议
     */
    @GET("property/workOrder/type/{pType}/{areaNo}")
    fun getOrderType(@Path("pType") pType: Int,@Path("areaNo") areaNo:String): Observable<BaseBean<List<OrderType>>>

    /**
     * 业主提交工单
     */
    @POST("property/workOrder/repair/create")
    fun submitReport(@Body body: RequestBody): Observable<BaseBean<Any>>

    /**
     * 业主提交投诉
     */
    @POST("property/workOrder/complain/create")
    fun submitComplaint(@Body body: RequestBody):Observable<BaseBean<Any?>>
    /**
     * 查看工单详情
     */
    @GET("property/workOrder/repair/view/{no}")
    fun getOrderDetail(@Path("no") no: String): Observable<BaseBean<OrderDetailBean>>

    /**
     * 查看投诉详情
     */
    @GET("property/workOrder/complain/view/{no}")
    fun getComplaintDetail(@Path("no")no:String):Observable<BaseBean<ComplaintDetailBean>>

    @GET("property/inspectTask/getOrder/{orderId}")
    fun getTakeCareFullOrder(@Path("orderId") orderId: String): Observable<BaseBean<WorkOrderDetailBean>>

    @POST("guest/guest/apply/list")
    fun getApplyList(@Body info: RequestBody): Observable<BaseBean<ApplyBean>>

    @POST("guest/guest/apply")
    fun addApply(@Body info: RequestBody): Observable<BaseBean<String>>


    @GET("guest/guest/apply/details/{applyId}")
    fun getApplyDetails(@Path("applyId") applyId: String): Observable<BaseBean<ApplyDetailBean>>

    @POST("guest/guest/apply/audit")
    fun applyAudit(@Body info: RequestBody): Observable<BaseBean<String>>

    @GET("guest/guest/apply/result")
    fun getApplyResult(
        @Query("applyId") applyId: String,
        @Query("mobile") mobile: String
    ): Observable<BaseBean<ApplyResultBean>>

    @GET("property/syc/common/listBuilding")
    fun listBuilding(
    ): Observable<BaseBean<List<BuildingtBean>>>

    @GET("property/syc/common/listFloor")
    fun listFloor(
        @Query("buildingId") buildingId: String,
    ): Observable<BaseBean<List<FloorBean>>>

    @GET("property/syc/common/listPointType")
    fun listPointType(
        @Query("systemId") systemId: String,
        ): Observable<BaseBean<List<DeviceTypeBean>>>

    /**
     */
    @POST("property/inspectTask/taskPage")
    fun inspectTaskTaskPage(@Body info: RequestBody): Observable<BaseBean<TakeCareRecordBean>>

    /**
     */
    @POST("property/inspectTask/scanPage")
    fun inspectTaskTaskScanPage(@Body info: RequestBody): Observable<BaseBean<TakeCareRecordBean>>


    @Multipart
    @Headers("url_name:img")
    @POST("file/upload")
    fun uploadImg(
        @QueryMap() params: Map<String, String>,
        @Part file: MultipartBody.Part
    ): Observable<BaseBean<ImgRspBean>>

    /**
     * 查询上架活动列表
     */
    @POST("property/activity/app/list")
    fun getCommunities(@Body body: RequestBody):Observable<BaseBean<CommunityResponseBean>>
    /**
     * 查询公告列表
     */
    @POST("property/bulletin/app/list")
    fun getNotices(@Body body: RequestBody):Observable<BaseBean<NoticeResponseBean>>
    /**
     * 查询个人报名活动列表
     */
    @POST("property/activity/app/profileList")
    fun getActivityProfileList(@Body body: RequestBody):Observable<BaseBean<ActivityProfileListBean>>
    /**
     * 查询活动详情
     */
    @GET("property/activity/app/read")
    fun getActivityDetail(@Query("activityId") activityId: String):Observable<BaseBean<ActivityDetailBean>>
    /**
     * 报名指定活动
     */
    @PUT("property/activity/app/registration")
    fun joinActivity(@Query("activityId") activityId: String):Observable<BaseBean<Any?>>
    /**
     * 查看指定公告
     */
    @GET("property/bulletin/app/read")
    fun getBulletinDetail(@Query("id") id:Int):Observable<BaseBean<BulletinDetailBean>>

}